//Created  on 2019/3/12 by  LCD:https://github.com/liucaide .

/***** 模块文档 *****
 *
 */



import Foundation
import UIKit
import CaamDauExtension


class ViewController: UIViewController {
    
    @IBOutlet weak var tableView: UITableView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        tableView.cd.background(.red).estimatedAll()
        
        print_cd("123")
        print_cd("来开噶".cd.pinyin().build)
        
    }
    
    
    @IBAction func clickButton(_ sender: UIButton) {
        
        PUSHTO(true, from: self) { ({_
            
        }) -> UIViewController in
            let vc = VCTwo()
            return vc
        } body: {
            var param:[AnyHashable:Any] = [:]
            param["name"] = "AAAAA"
            return param
        } callback: {
            return [:]
        }
        
    }
}

func PUSHTO(_ animated: Bool = true, from:UIViewController? = CD.visibleVC, tovc:((((UIViewController)->[AnyHashable:Any])? = nil)->UIViewController), callback:(()->[AnyHashable:Any])? = nil) {
    if let nvc = from?.navigationController {
        let vc = tovc()
        vc.hidesBottomBarWhenPushed = true
        vc.param = body
        nvc.pushViewController(vc, animated: animated)
    }else{
        from?.present(vc, animated: animated, completion: nil)
    }
}


class VCTwo: UIViewController {
    
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.title = "VCTwo"
        self.view.backgroundColor = .white
        
    }
}

class VM_ViewController {
    
    
}


